<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Enum
 *
 * @author Fabricio Freire
 */
class Enum {
    
    protected $self = array();
    
    public function __construct( /*...*/ ) {
        
        $args = func_get_args();
        for( $i=0, $n=count($args); $i<$n; $i++ )
            $this->add($args[$i]);
    }
    
    public function __get( /*string*/ $nome = null ) {
        return $this->self[$nome];
    }
    
    public function add( /*string*/ $nome = null, /*int*/ $enum = null ) {
        if( isset($enum) )
            $this->self[$nome] = $enum;
        else
            $this->self[$nome] = end($this->self) + 1;
    }
}

class EnumImpl extends Enum {
    
    public function __construct( /*array*/ $itens ) {
        
        foreach( $itens as $nome => $enum )
            $this->add($nome, $enum);
    }
}

?>
